from rest_framework import permissions


class IsCommonAdminUser(permissions.BasePermission):
    """普通用户访问权限"""

    def has_permission(self, request, view):
        if request.user.user_type == 1:
            return True
        return False


class IsTreasurerAdminUser(permissions.BasePermission):
    """财务用户访问权限"""

    def has_permission(self, request, view):
        if request.user.user_type == 2:
            return True
        return False


class IsManagerAdminUser(permissions.BasePermission):
    """总经理用户访问权限"""

    def has_permission(self, request, view):
        if request.user.user_type == 3:
            return True
        return False


class Check(permissions.BasePermission):
    """总经理用户访问权限"""

    def has_permission(self, request, view):
        if request.user.user_type in [2, 3]:
            return True
        return False
